package com.geralt.im.tool;

public class FormatTimeTool {
	public static String formatTime(long ms) {  
        StringBuilder timeString = new StringBuilder();
        int ss = 1000;  
        int mi = ss * 60;  
        int hh = mi * 60;  
        int dd = hh * 24;  

        long day = ms / dd;  
        long hour = ms%day / hh;  
        long minute = ms%day%hour / mi;  
        long second = ms%day%hour%minute / ss;

        String strDay = day < 10 ? "" : "" + day; 
        if(!strDay.equals(""))
        	timeString.append(strDay);
        String strHour = hour < 10 ? "" : "" + hour;
        if(!strHour.equals(""))
        	timeString.append(strHour);
        String strMinute = minute < 10 ? "" : "" + minute;
        if(!strMinute.equals(""))
        	timeString.append(strMinute);
        String strSecond = second < 10 ? "": "" + second;
        if(!strDay.equals(""))
        	timeString.append(strSecond);
        return timeString.toString();  
}  
}
